package com.coda.app.controller;

import com.coda.app.service.LeaseAgreementService;
import com.coda.app.service.PaymentTypeService;
import com.coda.entity.PaymentType;
import com.coda.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/app/payment")
@Api(tags = "支付方式")
public class PaymentTypeController {


    @Autowired
    private PaymentTypeService paymentTypeService;


    /**
     * 获取全部支付方式
     */
    @GetMapping("/list")
    @ApiOperation("获取全部支付方式")
    public Result<List<PaymentType>> getPaymentTypeList(){
        List<PaymentType> paymentTypeList = paymentTypeService.getPaymentTypeList();
        return Result.ok(paymentTypeList);
    }

    /**
     * 根据房间id获取可选支付方式
     */
    @GetMapping("listByRoomId")
    @ApiOperation("根据房间id获取可选支付方式")
    public Result<List<PaymentType>> getListByRoomId(@RequestParam Long id){
        List<PaymentType> paymentTypeList = paymentTypeService.getListPayment(id);
        return Result.ok(paymentTypeList);
    }
}
